﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminSite.Master" AutoEventWireup="true" CodeBehind="AgentsReport.aspx.cs" Inherits="Agents.Admin.AgentsReport" %>

<asp:Content ID="Header" ContentPlaceHolderID="Header" runat="server">
</asp:Content>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
    <h1>
        דו"חות עבודה של סוכנים
    </h1>
    <hr /><b>סוג הדו"ח: </b>
    <asp:RadioButtonList ID="radReportType" runat="server" CssClass="combobox" AutoPostBack="true"
                        OnSelectedIndexChanged="radReportType_SelectedIndexChanged">
        <asp:ListItem Text="שעות עבודה" Value="Hours" Selected="True"></asp:ListItem>
        <asp:ListItem Text="דו&quot;חות רווח" Value="Profit" Selected="False"></asp:ListItem>
    </asp:RadioButtonList>
    <asp:Panel ID="panelWorkingHours" runat="server" GroupingText="שעות עבודה של הסוכנים מתחילת החודש"
        Visible="true" Height="300px" Width="100%" ScrollBars="Vertical">
        <asp:DataGrid runat="server" ID="dgWorkingHours" AutoGenerateColumns="False"
            BackColor="White" BorderStyle="None" AllowPaging="false"
            CellPadding="3" GridLines="Both" CssClass="dataGrid" DataSourceID="SqlDataSource2"
            Font-Names="Verdana" BorderColor="#999999" BorderWidth="1px" 
            onitemdatabound="dgWorkingHours_ItemDataBound">
            <AlternatingItemStyle BackColor="#DCDCDC" />
            <Columns>
                <asp:BoundColumn DataField="Id" Visible="false" />
                <asp:BoundColumn DataField="Name" HeaderText="שם" />
                <asp:BoundColumn DataField="Mhours" HeaderText="שעות עבודה" DataFormatString="{0:F2}" />
            </Columns>
            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
            <ItemStyle BackColor="White" ForeColor="Black" />
            <SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
        </asp:DataGrid>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:AgentConnectionString %>" 
            SelectCommand=" SELECT [Id], [Name], [Mhours] 
                            FROM [Agents] 
                            ORDER BY [Mhours] DESC"></asp:SqlDataSource>
        סה"כ שעות עבודה החודש: 
        <asp:Label ID="lblTotal" Text="0" runat="server" />
    </asp:Panel>
    <asp:Panel ID="panelIncome" runat="server" GroupingText="חמשת הסוכנים הכי רווחיים החודש" Visible="false">
        <b>קריטריון: </b>
        <asp:RadioButtonList ID="profitCreteria" runat="server" AutoPostBack="true">
            <asp:ListItem Text="הכי הרבה הזמנות" Value="Morders" Selected="True"></asp:ListItem>
            <asp:ListItem Text="סכום כולל הכי גבוה" Value="Mincome" Selected="False"></asp:ListItem>
        </asp:RadioButtonList>
        <br />
        <asp:DataGrid runat="server" ID="dgAgents" AutoGenerateColumns="False"
            BackColor="White" BorderStyle="None" DataSourceID="SqlDataSource1"
            CellPadding="3" GridLines="Both" CssClass="dataGrid" 
            Font-Names="Verdana" BorderColor="#999999" BorderWidth="1px">
            <AlternatingItemStyle BackColor="#DCDCDC" />
            <Columns>
                <asp:BoundColumn DataField="Id" Visible="false" />
                <asp:BoundColumn DataField="Name" HeaderText="שם" />
                <asp:BoundColumn DataField="Morders" HeaderText="מספר הזמנות" />
                <asp:BoundColumn DataField="Mincome" HeaderText="סכום כולל" />
            </Columns>
            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
            <ItemStyle BackColor="White" ForeColor="Black" />
            <PagerStyle Mode="NumericPages" BackColor="#999999" ForeColor="Black" HorizontalAlign="Center">
            </PagerStyle>
            <SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
        </asp:DataGrid>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:AgentConnectionString %>" 
            SelectCommand="GetTopFiveAgents" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:ControlParameter ControlID="profitCreteria" PropertyName="SelectedIndex"
                                  Name="creteria" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </asp:Panel>
    <hr />
    <div class="alignCenter">
        <asp:Button ID="backBtn" Text="חזור" runat="server" onclick="backBtn_Click" CssClass="button"/>
    </div>
</asp:Content>
